import request from '@/utils/request'

// 学校首页 学校自查活动
export function getSchoolQuestionActives(schoolId) {
	let data = {
		schoolId
	}
	return request({
		'url': '/schoolQuestion/Activitys',
		'method': 'post',
		'params': data
	})
}

/**
 * 学校自查活动 每个活动指标
 * @param {Object} schoolId
 */
export function getSchoolActivityTarget(schoolId, activityId) {
	let data = {
		schoolId,
		activityId
	}
	return request({
		'url': '/schoolQuestion/getActivitySchoolTarget',
		'method': 'post',
		'params': data
	})
}

/**
 * 获取活动指标评论数据
 * @param {Object} schoolId
 * @param {Object} activityId
 * @param {Object} targetId
 */
export function getTarget(schoolId, activityId, targetId) {
	let data = {
		schoolId,
		activityId,
		targetId
	}
	return request({
		'url': '/schoolQuestion/getTarget',
		'method': 'get',
		'params': data
	})
}

/**
 * 保存学校自查

 * @param {Object} comments
 */
export function savePendingSchoolComment(comments) {

	comments = JSON.stringify(comments)
	let data = {
		comments
	}
	return request({
		'url': '/schoolQuestion/savePendingSchoolComment',
		'method': 'post',
		'params': data
	})
}

/**
 * 提交自查信息

 * @param {Object} comments
 */
export function addSchoolComment(comments) {

	comments = JSON.stringify(comments)
	let data = {
		comments
	}
	return request({
		'url': '/schoolQuestion/addSchoolComment',
		'method': 'post',
		'params': data
	})
}


/**
 * 学校督导报告活动

 */
export function getALLSchoolActivity() {

	return request({
		'url': '/schoolQuestion/getALLSchoolActivity',
		'method': 'post'
	})
}

/**
 * 学校自查报告

 * @param {Object} schoolId
 * @param {Object} activityId
 */
export function getSchoolReport(schoolId, activityId) {

	let data = {
		schoolId,
		activityId
	}

	return request({
		'url': '/schoolQuestion/getSchoolReport',
		'method': 'post',
		'params': data
	})
}

export function getSchoolMatterComent(schoolId, activityId) {

	let data = {
		schoolId,
		activityId
	}

	return request({
		'url': '/schoolQuestion/getschoolMattercoment',
		'method': 'post',
		'params': data
	})
}

/**
 * 督导端 视导 学校整改活动 待整改
 * @param {Object} schoolId
 */
export function schoolQuestion(schoolId) {

	let data = {
		schoolId
	}

	return request({
		'url': '/schoolQuestion',
		'method': 'post',
		'params': data
	})
}

/**
 * 督导端 视导 待整改 指标内容页面

 * @param {Object} id
 */
export function schoolTarget(id) {

	let data = {
		id
	}

	return request({
		'url': '/schoolQuestion/getSchoolTarget',
		'method': 'post',
		'params': data
	})
}


// 督导端 视导 保存待整改
export function saveSchoolComment(commentId, commentUrlId, content) {

	let data = {
		commentId,
		commentUrlId,
		content
	}
	console.log(data)
	return request({
		'url': '/schoolQuestion/saveSchoolComment',
		'method': 'post',
		'params': data
	})
}

// 督导端 视导 提交待整改
export function commitSchoolComment(commentId, content, contentId) {

	let data = {
		commentId,
		content,
		contentId
	}

	return request({
		'url': '/schoolQuestion/commitSchoolComment',
		'method': 'post',
		'params': data
	})
}





/**
 * 督导端 视导 学校整改活动 待复查

 * @param {Object} schoolId
 */
export function pending(schoolId) {
	console.log(schoolId)

	let data = {
		schoolId
	}

	return request({
		'url': '/schoolQuestion/Pending',
		'method': 'post',
		'params': data
	})
}






/**
 * 学校整改活动 已销账
 * @param {Object} schoolId
 */
export function imroved(schoolId) {

	let data = {
		schoolId
	}

	return request({
		'url': '/schoolQuestion/improved',
		'method': 'post',
		'params': data
	})
}

// 获取所有已经结束的活动的列表
export function getAllEndActivity() {

	return request({
		'url': '/rectification/getAllEndActivity',
		'method': 'post'
	})
}

// 校级别获取整改通知书
export function getSchoolNotice(schoolId) {

	let data = {
		schoolId
	}

	return request({
		'url': '/rectification/getSchoolNotice',
		'method': 'post',
		'params': data
	})
}

// 校级整改通知书详情
export function getZoneNoticeDetail(activityId, noticeId, schoolId) {

	let data = {
		activityId,
		noticeId,
		schoolId
	}

	return request({
		'url': '/rectification/getZoneNoticeDetail',
		'method': 'post',
		'params': data
	})
}


export function upload(deviceId, file) {

	let formData = new FormData();
	formData.append("deviceId", deviceId);
	formData.append("file", file)
	return request({
		'url': '/upload/uploadPic',
		'method': 'post',
		'data': formData
	})
}